home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Devices and Hardware / Velocity Engine / VelEng Wavelet / source / QTUtilities.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  9.4 KB  |  271 lines  |  [TEXT/CWIE]

  1. //////////
  2. //
  3. //    File:        QTUtilities.h
  4. //
  5. //    Contains:    Some utilities for working with QuickTime movies.
  6. //                All utilities start with the prefix "QTUtils_".
  7. //
  8. ///    Copyright:    © 1996-1999 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //    Change History (most recent first):
  11. //
  12. //       <2>         02/03/99    rtm        moved non-QTVR-specific utilities from QTVRUtilities to here
  13. //       <1>         09/10/97    rtm        first file
  14. //       
  15. //////////
  16. /*
  17.     Disclaimer:    IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  18.                 ("Apple") in consideration of your agreement to the following terms, and your
  19.                 use, installation, modification or redistribution of this Apple software
  20.                 constitutes acceptance of these terms.  If you do not agree with these terms,
  21.                 please do not use, install, modify or redistribute this Apple software.
  22.  
  23.                 In consideration of your agreement to abide by the following terms, and subject
  24.                 to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
  25.                 copyrights in this original Apple software (the "Apple Software"), to use,
  26.                 reproduce, modify and redistribute the Apple Software, with or without
  27.                 modifications, in source and/or binary forms; provided that if you redistribute
  28.                 the Apple Software in its entirety and without modifications, you must retain
  29.                 this notice and the following text and disclaimers in all such redistributions of
  30.                 the Apple Software.  Neither the name, trademarks, service marks or logos of
  31.                 Apple Computer, Inc. may be used to endorse or promote products derived from the
  32.                 Apple Software without specific prior written permission from Apple.  Except as
  33.                 expressly stated in this notice, no other rights or licenses, express or implied,
  34.                 are granted by Apple herein, including but not limited to any patent rights that
  35.                 may be infringed by your derivative works or by other works in which the Apple
  36.                 Software may be incorporated.
  37.  
  38.                 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
  39.                 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  40.                 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  41.                 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  42.                 COMBINATION WITH YOUR PRODUCTS.
  43.  
  44.                 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  45.                 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  46.                 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47.                 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  48.                 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
  49.                 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
  50.                 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  51. */
  52.  
  53. #pragma once
  54.  
  55.  
  56. //////////
  57. //
  58. // header files
  59. //
  60. //////////
  61.  
  62. #ifndef __QTUtilities__
  63. #define __QTUtilities__
  64.  
  65. #ifndef __MOVIES__
  66. #include <Movies.h>
  67. #endif
  68.  
  69. #ifndef __MOVIESFORMAT__
  70. #include <MoviesFormat.h>
  71. #endif
  72.  
  73. #ifndef __MEDIAHANDLERS__
  74. #include <MediaHandlers.h>
  75. #endif
  76.  
  77. #ifndef __NUMBERFORMATTING__
  78. #include <NumberFormatting.h>
  79. #endif
  80.  
  81. #ifndef __QUICKTIMECOMPONENTS__
  82. #include <QuickTimeComponents.h>
  83. #endif
  84.  
  85. #ifndef __QUICKTIMEVR__
  86. #include <QuickTimeVR.h>
  87. #endif
  88.  
  89. //#ifndef __QTSMOVIE__
  90. //#include <QTSMovie.h>
  91. //#endif
  92.  
  93. #ifndef __ENDIAN__
  94. #include <Endian.h>
  95. #endif
  96.  
  97. #ifndef __GESTALT__
  98. #include <Gestalt.h>
  99. #endif
  100.  
  101. #ifndef __FIXMATH__
  102. #include <FixMath.h>
  103. #endif
  104.  
  105. #ifndef __MACWINDOWS__
  106. #include <MacWindows.h>
  107. #endif
  108.  
  109. #ifndef __PRINTING__
  110. #include <Printing.h>
  111. #endif
  112.  
  113. #ifndef __SCRIPT__
  114. #include <Script.h>
  115. #endif
  116.  
  117. #ifndef __SOUND__
  118. #include <Sound.h>
  119. #endif
  120.  
  121. #ifndef _STRING_H
  122. #include <string.h>
  123. #endif
  124.  
  125. #ifndef _STDLIB_H
  126. #include <stdlib.h>
  127. #endif
  128.  
  129. #ifndef __TEXTUTILS__
  130. #include <TextUtils.h>
  131. #endif
  132.  
  133. #ifndef __TRAPS__
  134. #include <Traps.h>
  135. #endif
  136.  
  137.  
  138. //////////
  139. //
  140. // compiler flags
  141. //
  142. //////////
  143.  
  144. #define CONTENT_RATING_AVAIL        0            // is movie content-rating capability implemented?
  145.  
  146.  
  147. //////////
  148. //
  149. // constants
  150. //
  151. //////////
  152.  
  153. // constants used for QTUtils_SaveMovie
  154. #define kSavePrompt                    "Save Movie as:"
  155. #define kSaveMovieFileName            "untitled.mov"
  156. #define kSaveResName                "Movie Resource"
  157.  
  158. // constants used for QTUtils_PrintMoviePICT
  159. enum eQTUPICTPrinting {
  160.     kPrintFrame                        = 1, 
  161.     kPrintPoster                    = 2
  162. };
  163.  
  164. // constants used for QTUtils_GetMovieFileLoopingInfo
  165. enum {
  166.     kNormalLooping                    = 0, 
  167.     kPalindromeLooping                = 1, 
  168.     kNoLooping                        = 2
  169. };
  170.  
  171. #define kQTVideoEffectsMinVers        0x0300        // version of QT that first supports QT video effects
  172. #define kQTFullScreenMinVers        0x0209        // version of QT that first supports full-screen calls
  173. #define kQTWiredSpritesMinVers        0x0300        // version of QT that first supports wired sprites
  174.  
  175. // constants for GetQuickTimePreference/SetQuickTimePreference settings
  176. #define kConnectionSpeedPrefsType    FOUR_CHAR_CODE('cspd')
  177. #define kContentRatingPrefsType        FOUR_CHAR_CODE('crat')
  178.  
  179. enum {
  180.     kQTVRSpeakerButton         = mcFlagSuppressSpeakerButton,
  181.     kQTVRBackButton         = mcFlagQTVRSuppressBackBtn,
  182.     kQTVRZoomButtons         = mcFlagQTVRSuppressZoomBtns,
  183.     kQTVRHotSpotButton         = mcFlagQTVRSuppressHotSpotBtn,
  184.     kQTVRTranslateButton     = mcFlagQTVRSuppressTranslateBtn,
  185.     kQTVRHelpText             = mcFlagQTVRSuppressHelpText,
  186.     kQTVRHotSpotNames         = mcFlagQTVRSuppressHotSpotNames,
  187.     kQTVRCustomButton         = mcFlagsUseCustomButton
  188. };
  189.  
  190.  
  191. //////////
  192. //
  193. // data types
  194. //
  195. //////////
  196.  
  197. #if CONTENT_RATING_AVAIL
  198. // structure of content rating data for GetQuickTimePreference
  199. struct ContentRatingPrefsRecord {
  200.     UInt16                            fContentRating;
  201.     UInt16                            fContentTypes;
  202. };
  203. typedef struct ContentRatingPrefsRecord ContentRatingPrefsRecord;
  204. #endif
  205.  
  206.  
  207. //////////
  208. //
  209. // function prototypes
  210. //
  211. //////////
  212.  
  213. Boolean                        QTUtils_TrapAvailable (short theTrapWord);
  214. Boolean                        QTUtils_IsQuickTimeInstalled (void); 
  215. Boolean                        QTUtils_IsQuickTimeCFMInstalled (void);
  216. long                        QTUtils_GetQTVersion (void);
  217. Boolean                        QTUtils_HasQuickTimeVideoEffects (void);
  218. Boolean                        QTUtils_HasFullScreenSupport (void);
  219. Boolean                        QTUtils_HasWiredSprites (void);
  220. Boolean                        QTUtils_IsStreamedMovie (Movie theMovie);
  221. Movie                        QTUtils_GetMovie (FSSpec *theFSSpec, short *theRefNum, short *theResID);
  222. OSErr                        QTUtils_SaveMovie (Movie theMovie);
  223. Boolean                        QTUtils_IsControllerBarVisible (MovieController theMC); 
  224. short                        QTUtils_GetControllerBarHeight (MovieController theMC);
  225. void                        QTUtils_HideControllerBar (MovieController theMC);
  226. void                        QTUtils_ShowControllerBar (MovieController theMC);
  227. void                        QTUtils_ToggleControllerBar (MovieController theMC);
  228. void                        QTUtils_HideControllerButton (MovieController theMC, long theButton); 
  229. void                        QTUtils_ShowControllerButton (MovieController theMC, long theButton); 
  230. void                        QTUtils_ToggleControllerButton (MovieController theMC, long theButton);
  231. void                        QTUtils_ResetControllerButton (MovieController theMC, long theButton);
  232. Boolean                        QTUtils_IsControllerButtonVisible (MovieController theMC, long theButton);
  233. Boolean                        QTUtils_IsMediaTypeInMovie (Movie theMovie, OSType theMediaType);
  234. Boolean                        QTUtils_MovieHasTimeCodeTrack (Movie theMovie);
  235. Boolean                        QTUtils_MovieHasSoundTrack (Movie theMovie);
  236. MediaHandler                QTUtils_GetSoundMediaHandler (Movie theMovie);
  237. OSErr                        QTUtils_PrintMoviePICT (Movie theMovie, short x, short y, long PICTUsed);
  238. OSErr                        QTUtils_SelectAllMovie (MovieController mc);
  239. ImageDescriptionHandle        QTUtils_MakeSampleDescription (long theEffectType, short theWidth, short theHeight);
  240. OSErr                        QTUtils_GetContentRatingFromMovie (Movie theMovie, UInt16 *theRating, UInt32 *theReasons);
  241. OSErr                        QTUtils_AddContentRatingToMovie (Movie theMovie, UInt16 theRating, UInt32 theReasons);
  242. OSErr                        QTUtils_AddUserDataTextToMovie (Movie theMovie, char *theText, OSType theType);
  243. OSErr                        QTUtils_AddCopyrightToMovie (Movie theMovie, char *theText);
  244. OSErr                        QTUtils_AddMovieNameToMovie (Movie theMovie, char *theText);
  245. OSErr                        QTUtils_AddMovieInfoToMovie (Movie theMovie, char *theText);
  246. OSErr                        QTUtils_GetMovieFileLoopingInfo (Movie theMovie, long *theLoopInfo);
  247. OSErr                        QTUtils_SetMovieFileLoopingInfo (Movie theMovie, long theLoopInfo);
  248. OSErr                        QTUtils_SetLoopingStateFromFile (Movie theMovie, MovieController theMC);
  249. OSErr                        QTUtils_MakeMovieLoop (Movie theMovie, Boolean isPalindrome);
  250. char *                        QTUtils_GetTrackName (Track theTrack);
  251. OSErr                        QTUtils_SetTrackName (Track theTrack, char *theText);
  252. char *                        QTUtils_MakeTrackNameByType (Track theTrack);
  253. Boolean                        QTUtils_IsImageFile (FSSpec *theFSSpec);
  254. Boolean                        QTUtils_IsMovieFile (FSSpec *theFSSpec);
  255. void                        QTUtils_ConvertFloatToBigEndian (float *theFloat);
  256. StringPtr                    QTUtils_ConvertCToPascalString (char *theString);
  257. char *                        QTUtils_ConvertPascalToCString (StringPtr theString);
  258. OSErr                        QTUtils_DeleteAllReferencesToTrack (Track theTrack);
  259. TimeValue                    QTUtils_GetFrameDuration (Track theTrack);
  260. long                        QTUtils_GetFrameCount (Track theTrack);
  261. void                        QTUtils_GetMaxWindowDepth (CWindowPtr theWindow, short *thePixelType, short *thePixelSize);
  262. void                        QTUtils_GetMaxScreenDepth (Rect *theGlobalRect, short *thePixelType, short *thePixelSize);
  263. long                        QTUtils_GetUsersConnectionSpeed (void);
  264. OSErr                        QTUtils_SetUsersConnectionSpeed (long theSpeed);
  265. OSErr                        QTUtils_GetUsersContentRating (UInt32 *theType, UInt16 *theRating);
  266. OSType                        QTUtils_GetControllerType (Movie theMovie);
  267. OSErr                        QTUtils_SetControllerType (Movie theMovie, OSType theType);
  268. MovieController                QTUtils_ChangeControllerType (MovieController theMC, OSType theType, long theFlags);
  269.  
  270. #endif    // __QTUtilities__
  271.